﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RestService
{
    public class CustomHttpModule : IHttpModule
    {

        /*
        
        ApplicationPath = "/RestService"
        CurrentExecutionFilePath = "/RestService/xml/123"
          
        
        
         */

        public void Init(HttpApplication context)
        {
            context.BeginRequest += delegate
            {
                HttpContext ctx = HttpContext.Current;

                string path = ctx.Request.AppRelativeCurrentExecutionFilePath;
                
                if (!path.Contains(".svc"))
                {
                    string a = ctx.Request.ApplicationPath.Substring(1) + ".svc";
                    string b = string.Empty;
                    string c = ctx.Request.QueryString.ToString();
                    //ctx.RewritePath(a, b, c, false);
                }
            };
        }

        public void Dispose()
        {

        }
    }
}